import { axiosInstance } from '../../boot/axios'

export function nav () {
  return axiosInstance.get('/sys/menu/list')
}

export function menu () {
  return axiosInstance.get('/sys/menu/nav')
}

export function genNav (nav) {
  let newNav = []
  nav.forEach((item) => {
    if (item.component) {

      const component = item.component
      item.path = component.replace(/\//g,'-')

      let name = `${component}.vue`
      item.component = () => import(`pages/${name}`)
      newNav.push(item)

    }
  })
  return newNav
}

